<template>
    <div>
        <a-row>
            <a-row class='mytitle'>
                <div style="cursor: pointer;width: 360px" @click="handleNavigate">
                    <a-icon type="left" />
                    <span>{{ $t('返回') }}</span>
                    <span style="margin-left: 8px;">|</span>
                    <span style="margin-left: 8px">{{ dir }}</span>
                    <span style="margin-left: 8px">{{ $t('目录配额详情') }}</span>
                </div>
            </a-row>
        </a-row>

        <directory v-if="state == 1" :id="id" />
        <user v-else-if="state == 2" :id="id" :name="name" />
        <userGroup v-else-if="state == 3" :id="id" :name="name" />

    </div>
</template>
<script>
import NoAuthPage from '@/components/common/NoAuthPage'
import EmptyData from '@/components/common/EmptyData'
import directory from './directory.vue'
import user from './user.vue'
import userGroup from './userGroup.vue'

export default {
    components: { EmptyData, NoAuthPage, directory, user, userGroup },
    data() {
        return {
            dir: '',
            state: 0,
            id: '',
            name: ''
        }
    },
    async mounted() {
        const item = JSON.parse(decodeURIComponent(this.$route.query.item))
        this.dir = item.dir
        this.state = item.type
        this.id = item.id
        this.name = item.name
    },
    computed: {
        isShow() {
            if (this.dataList.length == 0) return false
            else if (this.result == 1) return false
            // else if (this.dataList.every(item => item.can_delete == false) == true) return false
            else if (this.dataList.every(item => !item.can_delete)) return false
            else return true
        }
    },
    methods: {
        handleNavigate() {
            this.$router.push({ path: '/fsview' })
        },
    }
}
</script>